package cn.agiledata.bank.myspace.dao;

import java.util.HashMap;
import java.util.Map;

import org.hibernate.SessionFactory;

import cn.agiledata.bank.common.dao.HqlPageListTemplate;
import cn.agiledata.bank.common.util.Constant;
import cn.agiledata.bank.myspace.bean.PeerBankAccountQueryBean;
import com.vnv.infrastructure.logic.IPBAppFactory;

public class PeerBankAccountPageList extends HqlPageListTemplate {
	private PeerBankAccountQueryBean bean;
	
	public PeerBankAccountPageList(PeerBankAccountQueryBean bean) {
		// TODO Auto-generated constructor stub
		this.setSessionFactory(
				(SessionFactory)IPBAppFactory.getObj("sessionFactory"));
		this.bean = bean;
	}

	public String getHql() {
		// TODO Auto-generated method stub
		String hSql = " from PeerBankAccount a where a.account.id=:accountId and (a.source=:source1 or a.source=:source2)";
		
		hSql += " order by a.updateTime desc,a.id desc";
		return hSql;
	}

	public String getPageRecord() {
		// TODO Auto-generated method stub
		return bean.getPageRecord();
	}

	public Map getParams() {
		// TODO Auto-generated method stub
		Map map = new HashMap();
		
		map.put("accountId", bean.getAccountId());
		map.put("source1", Constant.PEER_ACCOUNT_SOURCE_PREPARATIVE);
		map.put("source2", Constant.PEER_ACCOUNT_SOURCE_TRANSACTED);
		
		return map;
	}

	public String getStartPage() {
		// TODO Auto-generated method stub
		return bean.getStartPage();
	}

}
